import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-12-22
 * Time: 20:27
 */

public class Demo {
    public static void main(String[] args) throws InterruptedException {
        test();
    }
    //创建一个自动化实列
    public static void test() throws InterruptedException {
        ChromeDriver driver = new ChromeDriver();
        Thread.sleep(3000);
        //输入百度网站
        driver.get("https://www.baidu.com");
        Thread.sleep(3000);
        //找到百度的输入框 并输入关键词
        driver.findElement(By.cssSelector("#kw")).sendKeys("迪丽热巴");
        Thread.sleep(3000);
        //找到百度的按钮 并点击
        driver.findElement(By.cssSelector("#su")).click();
        Thread.sleep(3000);
        //释放资源 关闭浏览器
        driver.quit();

    }
}
